package com.xiaomei.manager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaomei.manager.dao.ExtensionMapper;
import com.xiaomei.manager.model.Extension;
import com.xiaomei.manager.service.IExtensionService;
import com.xiaomei.manager.web.dto.ExtensionDto;
import com.xiaomei.manager.web.page.Page;

@Service
public class IExtensionServiceImpl implements IExtensionService {
	@Autowired
	private ExtensionMapper extensionMapper;
	
	/**
     * 返回发放现金劵列表
     * @param page
     * @return
     */
	@Override
	public List<Extension> selectByParamMap(ExtensionDto dto,Page<Extension> page) {
		// TODO Auto-generated method stub
		page.setParamDto(dto);
		return extensionMapper.selectByParamMap(page);
	}
	/**
     * 新增
     * @param page
     * @return
     */
	@Override
	public boolean createExtension(Extension extension) {
		// TODO Auto-generated method stub
		return extensionMapper.insertSelective(extension) == 1 ? true :false;
	}
	@Override
	public Extension findOne(Integer id) {
		// TODO Auto-generated method stub
		return extensionMapper.selectByPrimaryKey(id);
	}
	@Override
	public boolean updateExtension(Extension extension) {
		// TODO Auto-generated method stub
		return extensionMapper.updateByPrimaryKeySelective(extension) == 1 ? true : false;
	}
	@Override
	public boolean deleteExtension(Integer id) {
		// TODO Auto-generated method stub
		return extensionMapper.deleteByPrimaryKey(id) == 1 ? true : false;
	}

}
